﻿using System.ComponentModel.DataAnnotations;

namespace DataModels.Dto.AuthCore
{
    // 定义微信返回结果的数据模型
    public class LoginResult
    {
        public string access_token { get; set; }
        public int expires_in { get; set; }
        public string errcode { get; set; }
        public string errmsg { get; set; }
    }

    public class PhoneNumberResult
    {
        public string phoneNumber { get; set; }
        public string purePhoneNumber { get; set; }
        public string countryCode { get; set; }
        public Watermark watermark { get; set; }
    }

    public class Watermark
    {
        public string appid { get; set; }
        public long timestamp { get; set; }
    }

    public class WeChatErrorResult
    {
        public string errcode { get; set; }
        public string errmsg { get; set; }
    }

    public class SignRequest
    {

        public string DisplayName {  get; set; }

        
    }

    public class VXPhNumber
    {
        public string PhoneNumber { get; set; }
    }
    // 微信API返回结果模型
    public class VxApiResult
    {
        public string AccessToken { get; set; }
        public int ExpiresIn { get; set; }
        public string RefreshToken { get; set; }
        public string OpenId { get; set; }
        public string UnionId { get; set; }
        public int Errcode { get; set; }
        public string Errmsg { get; set; }

        public string session_key { get; set; } // 用于解密用户数据的会话密钥
    }

    // 微信用户信息模型
    public class VxUserInfo
    {
        public string OpenId { get; set; }
        public string NickName { get; set; }
        public int Gender { get; set; }
        public string City { get; set; }
        public string Province { get; set; }
        public string Country { get; set; }
        public string AvatarUrl { get; set; }
        public string UnionId { get; set; }
    }

    public class VxLoginOrRegister
    {
        [Required(ErrorMessage = "Code不能为空")]
        public string Code { get; set; }
        public string encryptedData { get; set; }
        public string iv { get; set; } // 用于解密用户数据的向量
    }

    public class VxLogin
    {
        [Required(ErrorMessage = "code不能为空")]
        public string Code { get; set; }
    }

    public class PhoneCodeLoginOrRegister
    {
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号格式")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "验证码不能为空")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "验证码必须为6位")]
        public string Code { get; set; }

        public string? Password { get; set; }
    }
    public class PhonePasswordLogin
    {
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号格式")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "密码不能为空")]
        public string Password { get; set; }
    }
    public class SetNewPassword
    {
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号格式")]
        public string Phone { get; set; }
        [Required(ErrorMessage = "新密码不能为空")]
        public string NewPassword { get; set; }
        [Required(ErrorMessage = "验证码不能为空")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "验证码必须为6位")]
        public string Code { get; set; }
    }
    public class SendCode
    {
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号格式")]
        public string Phone { get; set; }
    }
    public class BindWeChat
    {
        [Required(ErrorMessage = "code不能为空")]
        public string Code { get; set; }

    }

    public class BindPhone
    {
        [Required(ErrorMessage = "手机号不能为空")]
        [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入正确的手机号格式")]
        public string Phone { get; set; }

        [Required(ErrorMessage = "验证码不能为空")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "验证码必须为6位")]
        public string Code { get; set; }
    }

    public class CancelAccount
    {
        [Required(ErrorMessage = "验证码不能为空")]
        [StringLength(6, MinimumLength = 6, ErrorMessage = "验证码必须为6位")]
        public string Code { get; set; }
    }
}
